<div ng-controller="Approval_RefundManageC">
    <div class="bg-light lter b-b wrapper-md">
        <h1 class="m-n font-thin h3">审批详情</h1>
    </div>
    <div style="padding: 0px 15px">
        <span><b>流程类型：</b>{{data.TypeName}}</span><br>
        <span><b>内容：</b>{{data.Title}}</span><br>
        <span><b>申请人：</b>{{data.Creater.Name}}</span><br>
        <span><b>审批人：</b>{{data.NowApproverName}}</span><br>
        <span><b>审批意见：</b>{{data.NowRemark}}</span><br>
        <div ng-if="data.ApprovalState==1||data.ApprovalState==0">
            <input ng-disabled="item.ApprovalState==2||item.ApprovalState==3" ng-model="data.opinion" type="text" class="form-control">
            <button type="button" class="btn btn-success" ng-click="DoAppr(true)" ng-hide="item.ApprovalState==2||item.ApprovalState==3">通过</button>
            <button type="button" class="btn btn-warning" ng-click="DoAppr(false)" ng-hide="item.ApprovalState==2||item.ApprovalState==3">驳回</button>
            <!-- <button type="button" class="btn btn-default" ng-click="goorderList()">返回列表</button> -->
            <span ng-show="item.ApprovalState==2">已通过</span>
            <span ng-show="item.ApprovalState==3">已驳回</span>
        </div>
        <button type="button" class="btn btn-default" ng-click="goorderList()">返回列表</button>

     </div>
</div>
<script>
    angular.module('app')
            .controller("Approval_RefundManageC", function($scope, $state, $http,$stateParams) {
                $http({
                    url: "/api/Approval?id=" + $stateParams.id,
                    method: "GET"
                    // data: { id: $stateParams.id}
                })
                        .then(function(res) {
                            $scope.data = res.data;
                            console.log($scope.data);
                        })
                        .then(function(error) {
                            if (error) {
                                alert("数据获取失败");
                            }
                        });

                //返回列表
                $scope.goorderList = function(){
                $state.go('app.Approval_Index');
            };
                $scope.DoAppr= function(isOk) {
                    $http.post("/api/Approval/Approval?id=" + $stateParams.id + "&pass=" + isOk + "&opinion=" + $scope.data.opinion)
                            .success(function() {
                                alert("审批完成");
                                $scope.goorderList();
                            }).error(function() {alert("处理失败")})
                }
            });
</script>